

local netpackys = require "netpackys"
local netpackyc = require "netpackyc"

local tempdata,tempsz
--------------------------------------

local socketobj = {
	getfd = function ()
		return 0
	end
} 	--socket.connect
local socket_writeraw = function (bdata,sz) 
	print("[C]socket_writeraw") 
	tempdata = bdata
	tempsz = sz
end
local socket_read = function () 
	print("[C]socket_read")
	return tempdata,tempsz 
end
local srcObj = {
	socket_read = socket_read,
	sendrawdata = socket_writeraw,
	npconfig = {
		sendrawdata = socket_writeraw,
	},
}
local netpackycObj = netpackyc.new(socketobj,srcObj)
--socketobj:connect()
netpackycObj:afterConnect()


local socketobj = {
	getfd = function ()
		return 0
	end
}	--socket.accept()
local socket_writeraw = function (bdata,sz) 
	print("[S]socket_writeraw") 
	tempdata = bdata
	tempsz = sz
end
local socket_read = function () 
	print("[S]socket_read")
	return tempdata,tempsz 
end
local srcObj = {
	socket_read = socket_read,
	sendrawdata = socket_writeraw,
	npconfig = {
		sendrawdata = socket_writeraw,
	},
}
local netpackysObj = netpackys.afterAccept(socketobj,srcObj)
netpackysObj:start()

netpackycObj:trystep()

netpackysObj:socket_write("hi")
netpackycObj:trystep()
netpackycObj:socket_write("hello")

netpackysObj:trystep()












---------------------------------------




